package com.hhd.flow.vo;


import com.hhd.flow.entity.FlowAttachment;
import com.hhd.flow.utils.CommonUtils;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.stream.Collectors;

@Getter
@Setter
public class WangEditorVo {
    int errno;
    List<EditorFile> data = CommonUtils.newList();

    public WangEditorVo(List<FlowAttachment> attachments) {
        errno = 0;
        data.addAll(attachments.stream().map(a -> new EditorFile(a.getUrl(), a.getFileName(), a.getUrl())).collect(Collectors.toList()));
    }
}